package Test;


import SysUser.SysUser;
import SysUserMapper.SysUserMapper;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.InputStream;
import java.util.List;

public class SysUserMapperTest {
    public void testUserListQuery()throws Exception{
        SqlSession sqlSession = null;
        List<SysUser> userList = null;
        try{
            String resource = "mybatis-config.xml";
            InputStream is = Resources.getResourceAsStream(resource);
            SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(is);
            sqlSession =factory.openSession();
            userList = sqlSession.getMapper(SysUserMapper.class).getUserList();
        }finally {
            sqlSession.close();
        }
    }
}
